<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>INSPINIA | 后台管理系统 </title>
    {css href="/static/inspinia/css/bootstrap.min.css" /}
    {css href="/static/inspinia/font-awesome/css/font-awesome.css" /}
    {css href="/static/iconfont/iconfont.css" /}
    <!--弹窗样式-->
    {css href="/static/inspinia/css/plugins/sweetalert/sweetalert.css" /}

    {block name="style"}{/block}

    {css href="/static/inspinia/css/animate.css" /}
    {css href="/static/inspinia/css/style.css" /}
</head>
<body>

<div id="wrapper">

    <nav class="navbar-default navbar-static-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav metismenu" id="side-menu">

                {volist name="menu" id="vo"}
                <li>
                    <a href="javascript:;"><i class="icon iconfont {$vo.icon|default=''}"></i> <span class="nav-label">{$vo.name}</span> <span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level collapse">
                        {volist name="vo.children" id="v"}
                        <li data-active="{$v.active}"><a href="{$v.url}">{$v.name}</a></li>
                        {/volist}
                    </ul>
                </li>
                {/volist}


            </ul>

        </div>
    </nav>

    <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom">
            <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                <div class="navbar-header">
                    <a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
                </div>
                <ul class="nav navbar-top-links navbar-right">
                    <li>
                        <span class="m-r-sm text-muted welcome-message">欢迎使用 禾迈 后台管理系统.</span>
                    </li>
                    <li class="cache_remover">
                        <a href="javascript:;">
                            <i class="fa fa-trash"></i> 清除缓存
                        </a>
                    </li>
                    <li class="logout">
                        <a href="javascript:;">
                            <i class="fa fa-sign-out"></i> 退出登录
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
        <div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-10">
                <ol class="breadcrumb">
                    {block name="breadcrumb"}{/block}
                </ol>
            </div>
            <div class="col-lg-2">

            </div>
        </div>
        <div class="wrapper wrapper-content animated fadeIn">
            <div class="row">
                {block name="body"}{/block}
            </div>
        </div>
        <div class="footer">
            <div>
                <strong>Copyright</strong> Example Company &copy; 2017  <a href="/">www.homylt.com</a>
            </div>
        </div>
    </div>
</div>


<!-- Mainly scripts -->
{js href="/static/inspinia/js/jquery-2.1.1.js" /}
{js href="/static/inspinia/js/bootstrap.min.js" /}
{js href="/static/inspinia/js/plugins/metisMenu/jquery.metisMenu.js" /}
{js href="/static/inspinia/js/plugins/slimscroll/jquery.slimscroll.min.js" /}

<!-- Custom and plugin javascript -->
{js href="/static/inspinia/js/inspinia.js" /}
{js href="/static/inspinia/js/plugins/pace/pace.min.js" /}

<!--弹窗js-->
{js href="/static/inspinia/js/plugins/sweetalert/sweetalert.min.js" /}

<script src="/static/admin/js/common.js?v={php}echo time();{/php}"></script>
{block name="javascript"}{/block}

<script>
    $(function () {
        var pathname = '{$now_menu.active}';
        console.log(pathname);
        $('#side-menu li[data-active="'+ pathname +'"]').addClass('active').parents('.collapse').addClass('in');

        $(".cache_remover").click(function () {
            $.get('{:url("CacheRemover/cache_remover")}', function (msg) {
                if (msg.code == 200) {
                    swal({
                        title: "缓存清除成功!",
                        type: "success"
                    });
                }
            }, 'json');
        });

        $(".logout").click(function () {
            swal({
                title: "退出登录?",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "确认",
                closeOnConfirm: false
            }, function () {
                window.location.href = '{:url("Login/logout")}';
            });
        });

        //监听提交
        $('[data-form="form"]').submit(function (event) {
            var _this = $(this);
            event.preventDefault();
            $.ajax({
                type : _this.attr('method'),
                url : _this.attr('action'),
                data : _this.serialize(),
                dataType : 'json',
                success : function (msg) {
                    if (msg.code == 200) {
                        swal({title: msg.msg}, function () {
                            if (msg.url) window.location.href = msg.url;
                        });
                    } else {
                        swal(msg.msg, " ", "error");
                    }
                }
            });
            return false;
        });
    });


</script>
</body>

</html>
